﻿using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Volo.Abp;
using Xms.Abp.Application.Dtos;
using Xms.Abp.AspNetCore.Mvc;

namespace IdentityManagement
{
    [RemoteService(Name = IdentityRemoteServiceConsts.RemoteServiceName)]
    [Area(IdentityRemoteServiceConsts.ModuleName)]
    [ControllerName("UserLookup")]
    [Route("api/management/organization/units")]
    public class OrganizationUnitController : XmsCrudController<IOrganizationUnitAppService, OrganizationUnitResult, Guid, OrganizationUnitPagedParameter, OrganizationUnitCreateParameter, OrganizationUnitUpdateParameter>, IOrganizationUnitAppService
    {
        [HttpPost]
        [Route("page/by-type")]
        public async Task<PagedResult<OrganizationUnitResult>> PagedByTypeAsync(OrganizationUnitFilterByTypePatameter parameter)
            => await CurrentService.PagedByTypeAsync(parameter);

        [HttpPost]
        [Route("tree")]
        public async Task<PagedResult<OrganizationUnitTreeResult>> GetTreeAsync(OrganizationUnitTreeFilterParameter parameter)
            => await CurrentService.GetTreeAsync(parameter);
    }
}
